babl.git
8 years agobabl: bail early on paths that are bad ideas
Øyvind Kolås [Tue, 5 Sep 2017 01:36:22 +0000 (03:36 +0200)]
babl: bail early on paths that are bad ideas

Not going through/bench-marking chains that will make the number of components
drop below the input/output counts, and not permitting a temporary lack of
alpha both fixes bugs at higher tolerances and speeds up path selection.

8 years agobabl: add babl_fast_fish api
Øyvind Kolås [Sun, 3 Sep 2017 20:53:27 +0000 (22:53 +0200)]
babl: add babl_fast_fish api

8 years agobabl: add R'G'B' u8 color space convertors
Øyvind Kolås [Sun, 3 Sep 2017 16:36:41 +0000 (18:36 +0200)]
babl: add R'G'B' u8 color space convertors

8 years agobabl: make TRCs internal API
Øyvind Kolås [Sun, 3 Sep 2017 16:27:49 +0000 (18:27 +0200)]
babl: make TRCs internal API

8 years agobabl: add Rec2020 space
Øyvind Kolås [Sun, 3 Sep 2017 16:19:35 +0000 (18:19 +0200)]
babl: add Rec2020 space

8 years agobabl: make matrix+trc space detector generic
Øyvind Kolås [Sun, 3 Sep 2017 14:25:03 +0000 (16:25 +0200)]
babl: make matrix+trc space detector generic

8 years agobabl: abstract space duplicate detection
Øyvind Kolås [Sun, 3 Sep 2017 14:03:13 +0000 (16:03 +0200)]
babl: abstract space duplicate detection

8 years agotools: follow constness change in icc parsing error handling
Øyvind Kolås [Sun, 3 Sep 2017 13:09:57 +0000 (15:09 +0200)]
tools: follow constness change in icc parsing error handling

8 years agobabl: make error argument of babl_space_from_icc optional
Øyvind Kolås [Sun, 3 Sep 2017 13:06:37 +0000 (15:06 +0200)]
babl: make error argument of babl_space_from_icc optional

8 years agobabl: detect sRGB profiles from matrix
Øyvind Kolås [Sat, 2 Sep 2017 23:00:49 +0000 (01:00 +0200)]
babl: detect sRGB profiles from matrix

When TRCs also are matching, return internal sRGB instead of creating a
duplicate.

8 years agobabl: indentation in trc
Øyvind Kolås [Sat, 2 Sep 2017 23:00:21 +0000 (01:00 +0200)]
babl: indentation in trc

8 years agobabl: move srgb detection to srgb_formula constructor
Øyvind Kolås [Sat, 2 Sep 2017 22:50:12 +0000 (00:50 +0200)]
babl: move srgb detection to srgb_formula constructor

8 years agobabl: fix overflow detection at end of luts
Øyvind Kolås [Sat, 2 Sep 2017 20:42:05 +0000 (22:42 +0200)]
babl: fix overflow detection at end of luts

8 years agobabl: implement interpolation for lut trcs
Øyvind Kolås [Sat, 2 Sep 2017 20:30:12 +0000 (22:30 +0200)]
babl: implement interpolation for lut trcs

8 years agobabl: icc implement ascii decoding of mluc
Øyvind Kolås [Sat, 2 Sep 2017 16:18:49 +0000 (18:18 +0200)]
babl: icc implement ascii decoding of mluc

8 years agobabl: add parametric handling for sRGB style TRCs (icc V4)
Øyvind Kolås [Sat, 2 Sep 2017 15:09:20 +0000 (17:09 +0200)]
babl: add parametric handling for sRGB style TRCs (icc V4)

8 years agobabl: use trcs own fun directly in early stages
Øyvind Kolås [Sat, 2 Sep 2017 13:33:19 +0000 (15:33 +0200)]
babl: use trcs own fun directly in early stages

8 years agotools: babl-icc-rewrite; abort with error message instead of segfault
Øyvind Kolås [Sat, 2 Sep 2017 13:32:23 +0000 (15:32 +0200)]
tools: babl-icc-rewrite; abort with error message instead of segfault

8 years agobabl: use babl_malloc instead of misgided use of aligned_alloc thinking it was like...
Øyvind Kolås [Sat, 2 Sep 2017 13:31:52 +0000 (15:31 +0200)]
babl: use babl_malloc instead of misgided use of aligned_alloc thinking it was like alloca

8 years agobabl: use _aligned_malloc() instead of aligned_alloc() on Win32.
Jehan [Sat, 2 Sep 2017 12:18:07 +0000 (14:18 +0200)]
babl: use _aligned_malloc() instead of aligned_alloc() on Win32.

Thanks to Lionel N. for raising the issue. It was failing to build for
Windows with:
> babl/babl-space.c:503: undefined reference to `aligned_alloc'
Windows has apparently a similar API, except that the size and alignment
parameters are inverted.
See https://msdn.microsoft.com/library/8z34s9c6.aspx

8 years agobabl-icc: add support for some ICCv4 profiles
Øyvind Kolås [Fri, 1 Sep 2017 20:52:27 +0000 (22:52 +0200)]
babl-icc: add support for some ICCv4 profiles

RGB Matrix profiles with not too complex (or sRGB) parametric TRCs is what
should work fine.

8 years agobabl: move RGB space conversion code to babl-space.c
Øyvind Kolås [Fri, 1 Sep 2017 19:31:24 +0000 (21:31 +0200)]
babl: move RGB space conversion code to babl-space.c

8 years agobabl: make trcs capable of iterating buffers
Øyvind Kolås [Fri, 1 Sep 2017 18:03:13 +0000 (20:03 +0200)]
babl: make trcs capable of iterating buffers

8 years agobabl: do one SSE2 memory load per pixel for color matrix transform
Øyvind Kolås [Fri, 1 Sep 2017 17:19:39 +0000 (19:19 +0200)]
babl: do one SSE2 memory load per pixel for color matrix transform

8 years agobabl: add sse2 acceleration for color transform
Øyvind Kolås [Fri, 1 Sep 2017 16:34:13 +0000 (18:34 +0200)]
babl: add sse2 acceleration for color transform

Many of the code paths are now duplicated, the duplication should decrease as
the SSE2/SIMD versions evolve further and stop resembling the code they were
cloned from.

8 years agobabl: change MAX_BUFFER_SIZE to 512
Øyvind Kolås [Thu, 31 Aug 2017 22:02:32 +0000 (00:02 +0200)]
babl: change MAX_BUFFER_SIZE to 512

This is the value that determins the smaller size big buffers are broken up in
and processed chunk-by chunk for multi-path conversions.

With tools/babl-benchmark for a particular workload and machine the following
results were attained, all values are in mb/s. There seem to be two sweet-spots
one around 128 and one around 512. Now using 512 which probably has better
cache behavior on most cpus than the old value 2048.

MAX_BUFFER_SIZE benchmarks,
    8:  437.1
   16:  458.8
   32:  495.0
   64:  482.6
   96:  496.4
  127:  508.8
  128:  514.2 506.7 495.1
  130:  494.6
  150:  479.5
  255:  492.2
  256:  491.0 486.8
  384:  500.8
  450:  503.7
  500:  499.6 496.5
  511:  477.8
  512:  511.0 508.7 500.6
  514:  499.3
  515:  504.7 502
  520:  512.9 491
  530:  501.8
  550:  483.3
  768:  493.0
 1024:  491.6
 2048:  489.5
 4096:  501.2
 8192:  499.0

8 years agobabl: refactor matrix_mul_vector further towards SIMD
Øyvind Kolås [Thu, 31 Aug 2017 21:07:34 +0000 (23:07 +0200)]
babl: refactor matrix_mul_vector further towards SIMD

8 years agobabl: register more RGB auto-converters for non-sRGB spaces
Øyvind Kolås [Thu, 31 Aug 2017 20:11:14 +0000 (22:11 +0200)]
babl: register more RGB auto-converters for non-sRGB spaces

8 years agobabl: use floating point version of srgb trc func
Øyvind Kolås [Thu, 31 Aug 2017 15:27:20 +0000 (17:27 +0200)]
babl: use floating point version of srgb trc func

8 years agotools: add c program for validating TRC approximations
Øyvind Kolås [Thu, 31 Aug 2017 14:37:32 +0000 (16:37 +0200)]
tools: add c program for validating TRC approximations

8 years agoreplace gamma approximations
Øyvind Kolås [Thu, 31 Aug 2017 11:16:28 +0000 (13:16 +0200)]
replace gamma approximations

8 years agobabl: move trc functions inside babl-trc.c
Øyvind Kolås [Thu, 31 Aug 2017 04:19:09 +0000 (06:19 +0200)]
babl: move trc functions inside babl-trc.c

Use lolremez 9 degree polynominal approximations for 1.8 and 2.2 gamma.

8 years agobabl: add separate functions for 1.8 and 2.2 gamma
Øyvind Kolås [Thu, 31 Aug 2017 03:32:42 +0000 (05:32 +0200)]
babl: add separate functions for 1.8 and 2.2 gamma

8 years agobabl: optimize powf and its use in u8tou8 internal converter
Øyvind Kolås [Thu, 31 Aug 2017 03:10:24 +0000 (05:10 +0200)]
babl: optimize powf and its use in u8tou8 internal converter

8 years agobabl: change how conversion computers (own) error
Øyvind Kolås [Thu, 31 Aug 2017 03:09:09 +0000 (05:09 +0200)]
babl: change how conversion computers (own) error

8 years agotools: babl-benchmark, print chosen paths
Øyvind Kolås [Thu, 31 Aug 2017 02:49:06 +0000 (04:49 +0200)]
tools: babl-benchmark, print chosen paths

8 years agobabl: include out own powf implementation
Øyvind Kolås [Thu, 31 Aug 2017 02:46:29 +0000 (04:46 +0200)]
babl: include out own powf implementation

8 years agoreduce set of default RGB spaces
Øyvind Kolås [Wed, 30 Aug 2017 16:03:18 +0000 (18:03 +0200)]
reduce set of default RGB spaces

8 years agoextensions/gray: add const for rgbtoxyz matrix return
Øyvind Kolås [Wed, 30 Aug 2017 15:57:12 +0000 (17:57 +0200)]
extensions/gray: add const for rgbtoxyz matrix return

8 years agobabl: only care about single precision for TRC
Øyvind Kolås [Wed, 30 Aug 2017 15:54:44 +0000 (17:54 +0200)]
babl: only care about single precision for TRC

8 years agobabl: make use of more direct trc dispatch in base
Øyvind Kolås [Wed, 30 Aug 2017 15:43:10 +0000 (17:43 +0200)]
babl: make use of more direct trc dispatch in base

8 years agoextensions: more direct trc dispatch
Øyvind Kolås [Wed, 30 Aug 2017 15:29:01 +0000 (17:29 +0200)]
extensions: more direct trc dispatch

8 years agobabl: speed up trc dispatch
Øyvind Kolås [Wed, 30 Aug 2017 15:09:28 +0000 (17:09 +0200)]
babl: speed up trc dispatch

By splitting the core computation done by the TRC down to callbacks of
different types, that all optionally can use the provided trc object.  This way
we can move the conditional for the polymorphism out of loops. The higher level
API of using the TRC still works - and is also accelerated by this change.

8 years agobabl: silence cast warning
Øyvind Kolås [Wed, 30 Aug 2017 14:38:05 +0000 (16:38 +0200)]
babl: silence cast warning

8 years agobabl: add commented out u8 rgb to rgb converter
Øyvind Kolås [Wed, 30 Aug 2017 02:32:22 +0000 (04:32 +0200)]
babl: add commented out u8 rgb to rgb converter

8 years agobabl: register conversions between all RGB spaces
Øyvind Kolås [Wed, 30 Aug 2017 00:20:47 +0000 (02:20 +0200)]
babl: register conversions between all RGB spaces

we register RGBA float and R'G'B'A float converters
between all spaces. This permits the converters between
precisions for each space to take effect.

8 years agobabl: add single precision cmm matrices
Øyvind Kolås [Sat, 26 Aug 2017 20:55:28 +0000 (22:55 +0200)]
babl: add single precision cmm matrices

8 years agobabl: on demand clone sRGB conversions
Øyvind Kolås [Tue, 29 Aug 2017 09:51:17 +0000 (11:51 +0200)]
babl: on demand clone sRGB conversions

When a new RGB space is encountered clone all sRGB space to sRGB space
conversions, under the assumption that they are implemented respecting/using
the customizable TRCs of babl.

8 years agoextensions/CIE: use RGB space functions for xyz
Øyvind Kolås [Wed, 30 Aug 2017 01:49:32 +0000 (03:49 +0200)]
extensions/CIE: use RGB space functions for xyz

8 years agoextensions/gimp-8bit: use RGB space TRCs
Øyvind Kolås [Tue, 29 Aug 2017 23:35:20 +0000 (01:35 +0200)]
extensions/gimp-8bit: use RGB space TRCs

8 years agoextensions/float: use RGB space TRCs
Øyvind Kolås [Tue, 29 Aug 2017 17:10:54 +0000 (19:10 +0200)]
extensions/float: use RGB space TRCs

8 years agoextensions/cairo: use RGB space trc functions
Øyvind Kolås [Tue, 29 Aug 2017 17:15:16 +0000 (19:15 +0200)]
extensions/cairo: use RGB space trc functions

8 years agobabl/babl-format: add formats with custom RGB spaces to format db
Øyvind Kolås [Tue, 29 Aug 2017 21:27:45 +0000 (23:27 +0200)]
babl/babl-format: add formats with custom RGB spaces to format db

8 years agotools/babl-benchmark: exclude conversions to self from average
Øyvind Kolås [Tue, 29 Aug 2017 18:21:32 +0000 (20:21 +0200)]
tools/babl-benchmark: exclude conversions to self from average

The fast path the checks for source == dst, and replace with memcpy works,
including these memcpy aliases makes the barchart harder to read and the
average further from the median.

8 years agobabl: move matrix code to new file babl-matrix.h
Øyvind Kolås [Sat, 26 Aug 2017 19:55:08 +0000 (21:55 +0200)]
babl: move matrix code to new file babl-matrix.h

8 years agobabl: remove unused babl_space_get_chromaticities
Øyvind Kolås [Sat, 26 Aug 2017 16:56:12 +0000 (18:56 +0200)]
babl: remove unused babl_space_get_chromaticities

8 years agobabl: make cache loading/parsing valgrind clean
Øyvind Kolås [Fri, 25 Aug 2017 23:14:28 +0000 (01:14 +0200)]
babl: make cache loading/parsing valgrind clean

8 years agobabl: initialize used BablModel struct member data on init
Øyvind Kolås [Fri, 25 Aug 2017 22:37:24 +0000 (00:37 +0200)]
babl: initialize used BablModel struct member data on init

8 years agobabl: iterate on public space/icc API
Øyvind Kolås [Thu, 24 Aug 2017 18:39:03 +0000 (20:39 +0200)]
babl: iterate on public space/icc API

8 years agobabl-icc: length of string in descr should include \0
Øyvind Kolås [Wed, 23 Aug 2017 23:16:57 +0000 (01:16 +0200)]
babl-icc: length of string in descr should include \0

8 years agotools: Use rand when random is unavailable
Edward E [Tue, 22 Aug 2017 21:31:56 +0000 (16:31 -0500)]
tools: Use rand when random is unavailable

borrowed from c1f075f22c70de54c2b04ca5df008a5e406d3ca9

8 years agobabl-icc: detect 2.2 and 1.8 gammas LUTs
Øyvind Kolås [Wed, 23 Aug 2017 20:43:34 +0000 (22:43 +0200)]
babl-icc: detect 2.2 and 1.8 gammas LUTs

8 years agobabl-icc: implement LUT TRC place holder code
Øyvind Kolås [Wed, 23 Aug 2017 20:16:51 +0000 (22:16 +0200)]
babl-icc: implement LUT TRC place holder code

8 years agobabl-icc: detect sRGB LUT TRC and use babl's native sRGB TRC
Øyvind Kolås [Wed, 23 Aug 2017 19:52:28 +0000 (21:52 +0200)]
babl-icc: detect sRGB LUT TRC and use babl's native sRGB TRC

Also add serialization of sRGB as an on-the fly generated 1024 element LUT.

8 years agobabl-icc: implement reading and writing of LUTs for TRC
Øyvind Kolås [Wed, 23 Aug 2017 18:22:24 +0000 (20:22 +0200)]
babl-icc: implement reading and writing of LUTs for TRC

8 years agobabl-icc: create struct for abstracting ICC file access
Øyvind Kolås [Wed, 23 Aug 2017 17:53:43 +0000 (19:53 +0200)]
babl-icc: create struct for abstracting ICC file access

This also makes the ICC parsing re-entrant by getting rid of global variables.

8 years agotools: add a tool for testing icc profile writing
Øyvind Kolås [Tue, 22 Aug 2017 12:00:21 +0000 (14:00 +0200)]
tools: add a tool for testing icc profile writing

8 years agobabl-icc: change priority of way to get matrix
Øyvind Kolås [Tue, 22 Aug 2017 11:53:19 +0000 (13:53 +0200)]
babl-icc: change priority of way to get matrix

8 years agobabl: add icc generator
Øyvind Kolås [Tue, 22 Aug 2017 10:23:02 +0000 (12:23 +0200)]
babl: add icc generator

Add API to generate concise ICC profiles in memory from babl-spaces, seems
complete apart for tRCs.

8 years agobabl: add babl-trc.h to Makefile.am
Øyvind Kolås [Tue, 22 Aug 2017 02:35:48 +0000 (04:35 +0200)]
babl: add babl-trc.h to Makefile.am

8 years agobabl: remove lingering reference to rgb-constants.h in makefile
Øyvind Kolås [Tue, 22 Aug 2017 02:28:05 +0000 (04:28 +0200)]
babl: remove lingering reference to rgb-constants.h in makefile

8 years agotools: add -e option to babl-icc-dumper, that shows exact fixed point values
Øyvind Kolås [Mon, 21 Aug 2017 16:11:43 +0000 (18:11 +0200)]
tools: add -e option to babl-icc-dumper, that shows exact fixed point values

8 years agobabl: use typedefs and structs for fixed point numbers
Øyvind Kolås [Sun, 20 Aug 2017 23:40:25 +0000 (01:40 +0200)]
babl: use typedefs and structs for fixed point numbers

also adds code to print exact decimal representations of numbers found in icc
files, can be useful for tuning constants fed in - our observing differences,
it turns out that ~6digits of precision is enough for double float and fixed point 32bit to differ in values in icc profiles.

8 years agotools: add babl-icc-dump
Øyvind Kolås [Sun, 20 Aug 2017 20:39:04 +0000 (22:39 +0200)]
tools: add babl-icc-dump

This commandline tool contains code to parse the v4 elements babl-icc currently
doesn't make use of. It loads data from the ICC profile directly into double
precision floats.

  CIE xy red: 0.640009 0.330022
  CIE xy green: 0.300008 0.600015
  CIE xy blue: 0.150011 0.059998

Is due to IEEE double precision floats not being as precise as the fixed point
values in the profile, which are *exactly*:

  CIE xy red:   0.6400  0.3300
  CIE xy green: 0.3000  0.6000
  CIE xy blue:  0.1500  0.0600

8 years agobabl: shorten missing fish message to mostly fit 80col
Øyvind Kolås [Sun, 20 Aug 2017 19:09:21 +0000 (21:09 +0200)]
babl: shorten missing fish message to mostly fit 80col

8 years agotools/babl-benchmark: add unicode barchart to results
Øyvind Kolås [Sun, 20 Aug 2017 19:05:52 +0000 (21:05 +0200)]
tools/babl-benchmark: add unicode barchart to results

8 years agobabl: icc parser, fix misname s15f16
Øyvind Kolås [Sun, 20 Aug 2017 16:08:46 +0000 (18:08 +0200)]
babl: icc parser, fix misname s15f16

8 years agotools: add a throughput benchmark
Øyvind Kolås [Sun, 20 Aug 2017 11:00:18 +0000 (13:00 +0200)]
tools: add a throughput benchmark

8 years agobabl: adapt conversion searcher for remodels
Øyvind Kolås [Sun, 20 Aug 2017 00:26:43 +0000 (02:26 +0200)]
babl: adapt conversion searcher for remodels

8 years agobabl: proof icc parsing against corrupt data
Øyvind Kolås [Sat, 19 Aug 2017 21:43:32 +0000 (23:43 +0200)]
babl: proof icc parsing against corrupt data

8 years agobabl: add babl_space_rgb_icc
Øyvind Kolås [Sat, 19 Aug 2017 21:08:03 +0000 (23:08 +0200)]
babl: add babl_space_rgb_icc

8 years agodocs: remove draft roadmap for custom primaries
Øyvind Kolås [Sat, 19 Aug 2017 12:54:13 +0000 (14:54 +0200)]
docs: remove draft roadmap for custom primaries

8 years agobabl: add babl_space_rgb_matrix
Øyvind Kolås [Sat, 19 Aug 2017 02:19:37 +0000 (04:19 +0200)]
babl: add babl_space_rgb_matrix

8 years agobabl: add handling of BABL_RGB_OVERRIDE environment variable
Øyvind Kolås [Sat, 19 Aug 2017 01:53:57 +0000 (03:53 +0200)]
babl: add handling of BABL_RGB_OVERRIDE environment variable

8 years agobabl: return the linear TRC when 1.0 is asked for numerically
Øyvind Kolås [Sat, 19 Aug 2017 01:53:16 +0000 (03:53 +0200)]
babl: return the linear TRC when 1.0 is asked for numerically

8 years agobabl: get rid of RGB_LUMINANCE constants
Øyvind Kolås [Sat, 19 Aug 2017 01:18:29 +0000 (03:18 +0200)]
babl: get rid of RGB_LUMINANCE constants

8 years agos/babl_space_new/babl_space_rgb_chromaticities
Øyvind Kolås [Sat, 19 Aug 2017 00:45:14 +0000 (02:45 +0200)]
s/babl_space_new/babl_space_rgb_chromaticities

8 years agobabl: respond to gcc warnings
Øyvind Kolås [Sat, 19 Aug 2017 00:44:30 +0000 (02:44 +0200)]
babl: respond to gcc warnings

8 years agobabl: make some of the new space API internal for now
Øyvind Kolås [Sat, 19 Aug 2017 00:37:22 +0000 (02:37 +0200)]
babl: make some of the new space API internal for now

8 years agoadd BablTRC class, that handles gamma or sRGB
Øyvind Kolås [Fri, 18 Aug 2017 23:20:46 +0000 (01:20 +0200)]
add BablTRC class, that handles gamma or sRGB

Done this way, it is easily extendable to also handle LUTs.

8 years agoextensions/CIE: replace rgb-to-xyz with one from source space
Øyvind Kolås [Fri, 18 Aug 2017 21:41:55 +0000 (23:41 +0200)]
extensions/CIE: replace rgb-to-xyz with one from source space

8 years agotests: add a test verifying that buffers are converted between RGB spaces
Øyvind Kolås [Fri, 18 Aug 2017 21:31:59 +0000 (23:31 +0200)]
tests: add a test verifying that buffers are converted between RGB spaces

8 years agomake use of babl space for reference computations
Øyvind Kolås [Fri, 18 Aug 2017 21:31:22 +0000 (23:31 +0200)]
make use of babl space for reference computations

8 years agoadd BablSpace for specifying chromaticities/TRC
Øyvind Kolås [Fri, 18 Aug 2017 21:15:43 +0000 (23:15 +0200)]
add BablSpace for specifying chromaticities/TRC

8 years agobabl: util.h fix double include guard
Øyvind Kolås [Thu, 17 Aug 2017 00:05:40 +0000 (02:05 +0200)]
babl: util.h fix double include guard

8 years agoAdd the BablConversion as first argument of all conversions
Øyvind Kolås [Fri, 18 Aug 2017 20:46:26 +0000 (22:46 +0200)]
Add the BablConversion as first argument of all conversions

This is neccesary to be able to access state of source/destination from within
registered conversions.

8 years agopost-release version bump
Øyvind Kolås [Tue, 15 Aug 2017 11:55:32 +0000 (13:55 +0200)]
post-release version bump

8 years agorelease 0.1.30
Øyvind Kolås [Tue, 15 Aug 2017 11:46:32 +0000 (13:46 +0200)]
release 0.1.30

8 years agobabl: clean up various syntax bugs.
Jehan [Tue, 4 Jul 2017 14:44:16 +0000 (16:44 +0200)]
babl: clean up various syntax bugs.

Trailing whitespaces, tabs, etc.

8 years agoconfigure: do not link with pthread on Android.
Jehan [Tue, 4 Jul 2017 12:05:34 +0000 (14:05 +0200)]
configure: do not link with pthread on Android.

It turns out Bionic (Android C library) has its own implementation of
pthread. With this minor change, babl is fully cross-compilable for
Android.